class OuterClass{
    public int data1 = 1;
    public int data2 = 2;
    public static int data3 = 3;
/*
* 1.如何拿到静态内部类的对象？
* OuterClass.InnerClass innerClass = new OuterClass.InnerClass();
* 2.不能在静态内部类当中，不能直接访问外部类非静态的成员
*
 * */
    static class InnerClass{
        public int data4 = 4;
        private int data5 = 5;
        public static int data6 = 6;
        public OuterClass outerClass;

        public InnerClass(){

        }

        public  InnerClass(OuterClass outerClass){
            System.out.println("静态内部类的构造方法");
            this.outerClass = outerClass;
        }

        public void test(){
            System.out.println("test方法执行了");
//          OuterClass outerClass = new OuterClass();
//          System.out.println(data1);
            System.out.println(outerClass.data1);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
        }
        public static void func2(){

        }
    }
}
public class TestDemo {

//    局部内部类,在方法中的类，只能在方法体内部使用
    public static void func3(){
        class A{
            public void test(){
                System.out.println("局部内部类里的方法");
            }
        }
        A a = new A();
        a.test();
    }

    public static void main(String[] args) {
        //func3();
    }

    public static void main1(String[] args) {
        OuterClass.InnerClass innerClass = new OuterClass.InnerClass();
        innerClass.test();
    }
}
